{% load key_tags %}
{% include "analysis/overview/_info.html" %}
<hr />
{% if analysis.malware_conf %}
    {% for config_block in analysis.malware_conf %}
        {% for family, config in config_block.items %}
            {% if family|slice:":1" != "_" %}
                <div class="card-header">
                    <a class="accordion-toggle" data-toggle="collapse" aria-expanded="true" href="#{{family}}_config"><i class="fas fa-tasks"></i><span> {{family}} Config</span></a>
                    {% if analysis.info.has_cents_rules %}
                        <a class="btn btn-secondary btn-sm" href="{% url "filereport" analysis.info.id "cents" %}"><span class="fas fa-download"></span> CENTS ruleset</a>
                    {% endif %}
                </div>
                <div id="{{family}}_config" class="collapse show extracted-config">
                    <table class="table table-striped table-bordered" style="table-layout: fixed;">
                        <thead>
                            <tr>
                                <th style="border-top: 0; width: 15%;">Type</th>
                                <th style="border-top: 0; word-wrap: break-word;">{{family}} Config</th>
                            </tr>
                        </thead>
                        {% if config_block|get_item:"_associated_config_hashes" %}
                            <tfoot>
                                <tr>
                                    <th>Extracted From</th>
                                    <td>
                                        {% for hashes in config_block|get_item:"_associated_config_hashes" %}
                                            <div class="card" style="margin-bottom: 4px">
                                                    {% with short_sha256=hashes.sha256|slice:":8" %}
                                                    {% with hashes_id=family|add:"-"|add:short_sha256 %}
                                                    {% with hashes_header_id=hashes_id|add:"-header" %}
                                                    <div class="card-header" id="{{ hashes_header_id }}" style="padding: 0px">
                                                        <h3 class="mb-0">
                                                            <a class="btn btn-block text-left" role="button" data-toggle="collapse" href="#{{ hashes_id }}" aria-expanded="false" aria-controls="{{ hashes_id }}">
                                                                <b>sha256:</b> {{ hashes.sha256 }}
                                                            </a>
                                                        </h3>
                                                    </div>
                                                    <div id="{{ hashes_id }}" class="collapse" aria-labelledby="{{ hashes_header_id }}">
                                                        <div class="card-body">
                                                            <dl class="row" style="margin-bottom: 0px">
                                                                {% with sorted_hashes=hashes|sort %}
                                                                    {% for algo, value in sorted_hashes.items %}
                                                                        <dt class="col-sm-1">{{ algo }}</dt>
                                                                        <dd class="col-sm-11">{{ value }}</dd>
                                                                    {% endfor %}
                                                                {% endwith %}
                                                            </dl>
                                                        </div>
                                                    </div>
                                                {% endwith %}
                                                {% endwith %}
                                                {% endwith %}
                                            </div>
                                        {% endfor %}
                                    </td>
                                </tr>
                            </tfoot>
                        {% endif %}
                        <tbody>
                            {% for key, value in config.items %}
                                <tr>
                                    <th style="border-top: 0; width: 15%;"><b>{{key}}</b></th>
                                    <td style="border-top: 0; word-wrap: break-word;">{% malware_config value %}</td>
                                </tr>
                            {% endfor %}
                        </tbody>
                    </table>
                </div>
            {% endif %}
        {% endfor %}
    {% endfor %}
<hr />
{% endif %}

{% if analysis.info.category in "file,static" and analysis.target %}
    <h4>File Details  {% if analysis.info.parent_sample %} <label for="parent_file"><a href="#parent_file" data-toggle="collapse"> - Parent file</a></label> {% endif %} </h4>
    {% if analysis.info.parent_sample %}
    <div class="form-group">
        <div id="parent_file" class="collapse">
            {% for file in analysis.info.parent_sample|parentfixup|dict2list %}
                {% include "analysis/generic/_file_info.html" %}
            {% endfor %}
        </div>
    </div>
    {% endif %}
    {% include "analysis/generic/_file_info.html" %}
{% elif analysis.info.category == "url" %}
    {% include "analysis/overview/_url.html" %}
{% endif %}

<div class="container">
    <div class="row">
        {% if reports_exist %}
        <div class="col-sm">
            {% include "analysis/overview/_reports.html" %}
        </div>
        {% endif %}
    </div>
</div>

{% if analysis.capa_summary %}
    <hr />
    {% include "analysis/overview/_capa_summary.html" %}
{% endif %}

{% if analysis.curtain %}
    <hr />
    {% include "analysis/overview/_curtain.html" %}
{% endif %}

{% if analysis.mitre_attck %}
    <hr />
    {% include "analysis/overview/_mitre.html" %}
{% endif %}
{% if analysis.statistics %}
    <hr />
    {% include "analysis/overview/_statistics.html" %}
{% endif %}
{% include "analysis/overview/_signatures.html" %}

{% include "analysis/overview/_screenshots.html" %}
{% if config.guacamole %}
    {% include "analysis/overview/_playback.html" %}
{% endif %}
<hr />
<div class="row">
    <div class="col-md-6 mx-auto">{% include "analysis/network/_hosts_not_ajax.html" %}</div>
    <div class="col-md-6 mx-auto">{% include "analysis/network/_dns_not_ajax.html" %}</div>
</div>
{% if analysis.info.category != "pcap" %}
    {% include "analysis/overview/_summary.html" %}
{% endif %}
